﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using testApp2.Models;

namespace testApp2.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            var usr = new User();
            usr.Interests = GetUserInterests();
            return View(usr);
        }

        public ActionResult InterestRow()
        {
            return PartialView("InterestEditor");
        }

        [HttpPost]
        public ActionResult Index(User model)
        {
            //check model.Interests to see what is posted
            return View("PostedData", model);
        }

        private static List<UserInterest> GetUserInterests()
        {
            var interestList = new List<UserInterest>();
            interestList.Add(new UserInterest { Id = 1, InterestText = "C#" });
            interestList.Add(new UserInterest { Id = 2, InterestText = "Java", IsExperienced = true });
            return interestList;
        }

    }
}
